﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using sdm.exam.domain;
using sdm.exam.domain.Abstract;
using sdm.exam.domain.DataContext;
using sdm.exam.domain.Entities;

namespace sdm.exam.test.Domain
{
    [TestClass]
    public class StudyPlanDomainTest
    {
        private StudyPlanDomain _domain = null;
        [TestInitialize]
        public void Start()
        {
            Ninjector.Kernel.Bind<ISdmExamRepository>().ToConstant(new DataContext(ConnectionStrings.TestConnection));
            _domain = new StudyPlanDomain();
        }

        [TestCleanup]
        public void End()
        {
            Ninjector.Kernel.Unbind<ISdmExamRepository>();
        }

        [TestMethod]
        public void AddStudyplanTest()
        {
            var semesterClass = new SemesterClass()
                                   {
                                       Name = "CS2010",
                                       EndDate = new DateTime(2013, 2, 28),
                                       StartDate = new DateTime(2010, 9, 2),
                                       Education = new Education {Name = "Computer Science"}
                                   };
            var courseList = new List<Course>()
                                 {
                                     new Course{Name = "SDM"},
                                     new Course{ Name = "Android" }
                                 };

            var studyPlan = new Studyplan
                                {Courses = courseList, SemesterClass = semesterClass, IsAssignedToSemesterClass = false};

            bool success = _domain.AddStudyPlan(studyPlan);

            Assert.IsTrue(success);
        }
    }
}
